#include <stdio.h>

int main(void)
{
	int score, sum = 0, n = 0, avg;

	printf("Input some integers ending with -1: ");
	scanf("%d", &score);
	while (score != -1)
	{
		sum += score;
		n++;
		scanf("%d", &score);
	}
	if (n > 0)
	{
		avg = sum / n;
		printf("avg = %d\n", avg);
	}
	else
		printf("error!\n");

	return 0;
}